<?php

namespace App\Http\Controllers\Api\Common;

use App\Http\Controllers\Controller;
use App\Models\Admin\Api;
use App\Models\Common;
use Illuminate\Http\Request;

class VerController extends Controller
{
    public function index(Request $request){
        $get = $request->only(['appid','ver']);
        if(isset($get['appid']) && isset($get['ver'])){
            $api = Api::find($get['appid']);
            if($api){
                if($api['ver']!=$get['ver']){
                    Common::resJson(['code'=>10000,'data'=>['url'=>$api['url'],'ver'=>$api['ver']],'msg'=>'需要升级']);
                }else{
                    Common::resJson(['code'=>10001,'data'=>'','msg'=>'不需要升级']);
                }
            }else{
                Common::resJson(['code'=>10002,'data'=>'','msg'=>'无数据']);
            }
        }else{
            Common::resJson(['code'=>10003,'data'=>'','msg'=>'缺少参数']);
        }
    }
}
